#include "qdrivemission.h"

QDriveMission::QDriveMission():
    m_missionID(0),
    m_valueAddress(0),
    m_period(0),
    m_level(0),
    m_dataLengh(0),
    m_deviceAddress(0),
    m_missionType(MT_CYCLE),
    m_missionState(MS_NOTDO),
    m_cammand(MC_READ),
    m_failedCode(0)
{
    memset(m_data,0,128*sizeof(ushort));
}

void QDriveMission::setAttribute(const QString &key, const QString &value)
{
    m_attribute.insert(key,value);
}

QString QDriveMission::attribute(const QString &key, const QString &def)
{
    return m_attribute.value(key,def);
}

uint QDriveMission::missionID()
{
    return m_missionID;
}

int QDriveMission::period()
{
    return m_period;
}

int QDriveMission::valueAddress()
{
    return m_valueAddress;
}

int QDriveMission::level()
{
    return m_level;
}

int QDriveMission::dataLengh()
{
    return m_dataLengh;
}

int QDriveMission::deviceAddress()
{
    return m_deviceAddress;
}

enMissionType QDriveMission::type()
{
    return m_missionType;
}

QDateTime QDriveMission::lastTime()
{
    return m_lastTime;
}

enMissionState QDriveMission::missionState()
{
    return m_missionState;
}

enMissionCammand QDriveMission::missionCammand()
{
    return m_cammand;
}

ushort *QDriveMission::data()
{
    return m_data;
}

int QDriveMission::failedCode()
{
    return m_failedCode;
}

void QDriveMission::setMissionID(uint missionID)
{
    m_missionID=missionID;
}

void QDriveMission::setValueAdress(int adress)
{
    m_valueAddress=adress;
}

void QDriveMission::setLevel(int level)
{
    m_level=level;
}

void QDriveMission::setPeriod(int period)
{
    m_period=period;
}

void QDriveMission::setType(enMissionType type)
{
    m_missionType=type;
}

void QDriveMission::setDataLengh(int lengh)
{
    m_dataLengh=lengh;
}

void QDriveMission::setDeviceAdress(int adress)
{
    m_deviceAddress=adress;
}

void QDriveMission::setLastTime(const QDateTime &time)
{
    m_lastTime=time;
}

void QDriveMission::setMissionState(enMissionState state)
{
    m_missionState=state;
}

void QDriveMission::setMissionCammand(enMissionCammand cammand)
{
    m_cammand=cammand;
}

void QDriveMission::setData(ushort *us,int len)
{
    memcpy(m_data,us,len*sizeof(ushort));
}

void QDriveMission::setFailedCode(int code)
{
    m_failedCode=code;
}
